<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
<h:body>
	<style type="text/css">
.ui-selectonemenu-label {
	width: 100% !important;
}

.ui-selectonemenu {
	width: 100% !important;
}
</style>
	<ui:composition template="/WEB-INF/templates/template.xhtml">
		<ui:define name="content">
			<h:form id="form">
				<p:growl id="growl" sticky="false" autoUpdate="true"
					showDetail="true" />
				<p:panel header="#{msg.title_cat_nav_child}" id="panel_data">
					<p:outputLabel for="selectOneParent" value="#{msg.select_one}" />
					<h:panelGrid columns="2">
						<p:selectOneMenu id="selectOneParent"
							value="#{nc_controller.currentParentId}" style="">
							<f:selectItems value="#{nc_controller.listParents}" var="parent"
								itemValue="#{parent.idParent}" itemLabel="#{parent.text}" />
						</p:selectOneMenu>
						<p:commandButton action="#{nc_controller.refreshChilds}"
							icon="ui-icon-arrowrefresh-1-w" update="panel_data" />
					</h:panelGrid>
					<p:commandButton value="#{msg.new}" icon="ui-icon-plusthick"
						onclick="PF('dlgNew').show();" update=":formNew:panelgrid_new" />
					<p:commandButton value="#{msg.ver}" icon="ui-icon-search"
						oncomplete="PF('dlgView').show();"
						update=":formView:panelgrid_view" />
					<p:commandButton value="#{msg.edit}" icon="ui-icon-pencil"
						onclick="PF('dlgEdit').show();" update=":formEdit:panelgrid_edit" />
					<p:commandButton value="#{msg.delete}" icon="ui-icon-trash"
						onclick="PF('dlgDelete').show();" />
					<br />
					<p:dataTable value="#{nc_controller.itemsList}" var="item"
						rows="10" paginator="true"
						currentPageReportTemplate="{startRecord} de {endRecord}"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="5,10,15" paginatorPosition="bottom"
						resizableColumns="true" selection="#{nc_controller.currentItem}"
						rowKey="#{item.idChild}" id="table">
						<p:column selectionMode="single"
							style="width:16px;text-align:center" />
						<p:column headerText="#{msg.id}" sortBy="#{item.idChild}"
							filterBy="#{item.idChild}">
							<h:outputText value="#{item.idChild}" />
						</p:column>
						<p:column headerText="#{msg.text}" sortBy="#{item.text}"
							filterBy="#{item.text}">
							<h:outputText value="#{item.text}" />
						</p:column>
						<p:column headerText="#{msg.outcome}" sortBy="#{item.outcome}"
							filterBy="#{item.outcome}">
							<h:outputText value="#{item.outcome}" />
						</p:column>
						<p:column headerText="#{msg.url}" sortBy="#{item.url}"
							filterBy="#{item.url}">
							<h:outputText value="#{item.url}" />
						</p:column>
					</p:dataTable>
				</p:panel>
			</h:form>
			<!-- Panel for view -->
			<p:dialog header="#{msg.detail}" widgetVar="dlgView"
				style="position:fixed;">
				<h:form id="formView">
					<p:outputPanel id="outputPanel_view">
						<h:panelGrid columns="2" id="panelgrid_view">
							<p:outputLabel value="#{msg.id}" for="current_item_view_id" />
							<h:outputText value="#{nc_controller.currentItem.idChild}"
								id="current_item_view_id" />
							<p:outputLabel value="#{msg.text}" for="current_item_view_dsc" />
							<h:outputText value="#{nc_controller.currentItem.text}"
								id="current_item_view_dsc" />
							<p:outputLabel value="#{msg.outcome}"
								for="current_item_view_outcome" />
							<h:outputText value="#{nc_controller.currentItem.outcome}"
								id="current_item_view_outcome" />
							<p:outputLabel value="#{msg.url}" for="current_item_view_url" />
							<h:outputText value="#{nc_controller.currentItem.url}"
								id="current_item_view_url" />
						</h:panelGrid>
						<div style="float: right;">
							<p:commandButton value="#{msg.accept}"
								onclick="PF('dlgView').hide();" type="button"
								icon="ui-icon-check" />
						</div>
					</p:outputPanel>
				</h:form>
			</p:dialog>
			<!-- End panel for view -->
			<!-- Panel for edit -->
			<p:dialog header="#{msg.edit}" widgetVar="dlgEdit" modal="true"
				style="position:fixed;">
				<h:form id="formEdit">
					<p:outputPanel id="outputPanelEdit">
						<h:panelGrid columns="3" id="panelgrid_edit">
							<p:outputLabel value="#{msg.parent}"
								for="current_item_edit_parent" />
							<p:selectOneMenu value="#{nc_controller.input_edit_parentId}"
								id="current_item_edit_parent">
								<f:selectItems value="#{nc_controller.listParents}" var="parent"
									itemValue="#{parent.idParent}" itemLabel="#{parent.text}" />
							</p:selectOneMenu>
							<h:outputText value="" />
							<p:outputLabel value="#{msg.id}" for="current_item_edit_id" />
							<h:outputText value="#{nc_controller.currentItem.idChild}"
								id="current_item_edit_id" />
							<h:outputText value="" />
							<p:outputLabel value="#{msg.text}" for="current_item_edit_dsc" />
							<p:inputText value="#{nc_controller.input_edit_text}"
								id="current_item_edit_dsc" />
							<p:watermark value="#{nc_controller.currentItem.text}"
								for="current_item_edit_dsc" />
							<p:outputLabel value="#{msg.outcome}"
								for="current_item_edit_outcome" />
							<p:inputText value="#{nc_controller.input_edit_outcome}"
								id="current_item_edit_outcome" />
							<p:watermark value="#{nc_controller.currentItem.outcome}"
								for="current_item_edit_outcome" />
							<p:outputLabel value="#{msg.url}" for="current_item_edit_url" />
							<p:inputText value="#{nc_controller.input_edit_url}"
								id="current_item_edit_url" />
							<p:watermark value="#{nc_controller.currentItem.url}"
								for="current_item_edit_url" />
						</h:panelGrid>
						<h:panelGrid columns="2">
							<p:commandButton value="#{msg.accept}"
								oncomplete="handlRequest(xhr, status, args, 'dlgEdit')"
								icon="ui-icon-check"
								actionListener="#{nc_controller.onEditNavigationChild}"
								update=":form:table" />
							<p:commandButton value="#{msg.cancel}"
								onclick="PF('dlgEdit').hide();" icon="ui-icon-close"
								actionListener="#{nc_controller.onEditCancelNavigationChild}"
								immediate="true" />
						</h:panelGrid>
					</p:outputPanel>
				</h:form>
			</p:dialog>
			<!-- End panel for edit -->
			<!-- Panel for new -->
			<p:dialog header="#{msg.new}" widgetVar="dlgNew" modal="true"
				style="position:fixed;">
				<h:form id="formNew">
					<p:outputPanel id="outputPanelNew">
						<p:focus context=":formNew:outputPanelNew" />
						<h:panelGrid columns="3" id="panelgrid_new">
							<p:outputLabel value="#{msg.parent}"
								for="current_item_new_parent" />
							<p:selectOneMenu id="current_item_new_parent"
								value="#{nc_controller.input_new_parentId}" required="true"
								requiredMessage="#{msg.required_input_parent}">
								<f:selectItems value="#{nc_controller.listParents}" var="parent"
									itemValue="#{parent.idParent}" itemLabel="#{parent.text}" />
							</p:selectOneMenu>
							<p:message for="current_item_new_parent" />
							<p:outputLabel value="#{msg.text}" for="current_item_new_dsc"
								style="tex-align:left;" />
							<p:inputText value="#{nc_controller.input_new_text}"
								id="current_item_new_dsc" required="true" label="#{msg.text}"
								requiredMessage="#{msg.required_input_text}" />
							<p:message for="current_item_new_dsc" />
							<p:outputLabel value="#{msg.outcome}"
								for="current_item_new_outcome" style="tex-align:left;" />
							<p:inputText value="#{nc_controller.input_new_outcome}"
								id="current_item_new_outcome" required="true"
								label="#{msg.outcome}"
								requiredMessage="#{msg.required_input_outcome}" />
							<p:message for="current_item_new_outcome" />
							<p:outputLabel value="#{msg.url}" for="current_item_new_url"
								style="tex-align:left;" />
							<p:inputText value="#{nc_controller.input_new_url}"
								id="current_item_new_url" required="true" label="#{msg.url}"
								requiredMessage="#{msg.required_input_url}" />
							<p:message for="current_item_new_url" />
						</h:panelGrid>
						<h:panelGrid columns="2">
							<p:commandButton value="#{msg.accept}"
								oncomplete="handlRequest(xhr, status, args, 'dlgNew')"
								icon="ui-icon-check"
								actionListener="#{nc_controller.onSaveNavigationChild}"
								update=":form:table :formNew:panelgrid_new" />
							<p:commandButton value="#{msg.cancel}"
								onclick="PF('dlgNew').hide();" icon="ui-icon-close"
								immediate="true"
								actionListener="#{nc_controller.onSaveCancelNavigationChild}" />
						</h:panelGrid>
					</p:outputPanel>
				</h:form>
			</p:dialog>
			<!-- End panel for new -->
			<!-- Panel for delete -->
			<p:confirmDialog widgetVar="dlgDelete" resizable="false"
				header="#{msg.action_confirm}" message="#{msg.delete_item_message}">
				<h:form id="formDelete">
					<p:commandButton value="#{msg.accept}" update=":form:table"
						styleClass="ui-confirmdialog-yes" icon="ui-icon-check"
						oncomplete="PF('dlgDelete').hide();"
						actionListener="#{nc_controller.onDeleteNavigationChild}" />
					<p:commandButton value="#{msg.cancel}"
						onclick="PF('dlgDelete').hide();" immediate="true"
						actionListener="#{nc_controller.onDeleteCancelNavigationChild}"
						styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</h:form>
			</p:confirmDialog>
			<!-- End panel for delete -->
		</ui:define>
	</ui:composition>

</h:body>
</html>